package one.stand.service.impl;

import one.stand.mapper.IndustryMapper;
import one.stand.model.IndustryModel;
import one.stand.model.ResultModel;
import one.stand.response.IndustryResponse;
import one.stand.service.IndustryService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 */
@Service
public class IndustryServiceImpl implements IndustryService {
    @Autowired
    protected IndustryMapper industryMapper;

    @Override
//    @Cacheable(value = RedisCode.REDIS_DB_CACHE,key = "#root.targetClass.toString()+'.'+#root.methodName")
    public ResultModel<List<IndustryResponse>> getList() {
        List<IndustryModel> modelList = industryMapper.getList(new IndustryModel());
        List<IndustryResponse> responseList = new ArrayList<>();
        modelList.forEach(m -> {
            IndustryResponse response = new IndustryResponse();
            BeanUtils.copyProperties(m, response);
            responseList.add(response);
        });

        return ResultModel.success(responseList);
    }
}
